﻿#pragma once

#include "../Shared/Functions/IniReader.h"
#include <string>
#include <vector>
#include "../tangible_filesystem.h"

using namespace Client::MirSounds;


namespace Client
{

    enum class KeybindOptions : int
    {
        Bar1Skill1 = 0,
        Bar1Skill2,
        Bar1Skill3,
        Bar1Skill4,
        Bar1Skill5,
        Bar1Skill6,
        Bar1Skill7,
        Bar1Skill8,
        Bar2Skill1,
        Bar2Skill2,
        Bar2Skill3,
        Bar2Skill4,
        Bar2Skill5,
        Bar2Skill6,
        Bar2Skill7,
        Bar2Skill8,
        Inventory,
        Inventory2,
        Equipment,
        Equipment2,
        Skills,
        Skills2,
        Creature,
        MountWindow,
        Mount,
        Fishing,
        Skillbar,
        Mentor,
        Relationship,
        Friends,
        Guilds,
        GameShop,
        Quests,
        Closeall,
        Options,
        Options2,
        Group,
        Belt,
        BeltFlip,
        Pickup,
        Belt1,
        Belt1Alt,
        Belt2,
        Belt2Alt,
        Belt3,
        Belt3Alt,
        Belt4,
        Belt4Alt,
        Belt5,
        Belt5Alt,
        Belt6,
        Belt6Alt,
        Logout,
        Exit,
        CreaturePickup,
        CreatureAutoPickup,
        Minimap,
        Bigmap,
        Trade,
        Rental,
        ChangeAttackmode,
        AttackmodePeace,
        AttackmodeGroup,
        AttackmodeGuild,
        AttackmodeEnemyguild,
        AttackmodeRedbrown,
        AttackmodeAll,
        ChangePetmode,
        PetmodeBoth,
        PetmodeMoveonly,
        PetmodeAttackonly,
        PetmodeNone,
        Help,
        Keybind,
        Autorun,
        Cameramode,
        Screenshot,
        DropView,
        TargetDead,
        Ranking,
        AddGroupMember
    };

    class KeyBind
    {
    public:
        KeybindOptions function = KeybindOptions::Bar1Skill1;
        std::string Group = "", Description = "";
        Keys *Key = 0;

        /// <summary>
        /// Require Options : 0 = Require unpressed key, 1 = Require pressed key, 2 = Don't care
        /// </summary>
        unsigned char RequireCtrl = 0;
        unsigned char RequireShift = 0;
        unsigned char RequireAlt = 0;
        unsigned char RequireTilde = 0;
        virtual ~KeyBind()
        {
            delete Key;
        }

    };


    class KeyBindSettings
    {
    private:
        static InIReader *Reader;
    public:
        std::vector<KeyBind*> Keylist = std::vector<KeyBind*>();
        std::vector<KeyBind*> DefaultKeylist = std::vector<KeyBind*>();

        KeyBindSettings();

        void Load();

        void Save();

        void New(std::vector<KeyBind*> &list);

        std::string GetKey(KeybindOptions Option, bool defaultKey = false);
    };


}
